﻿using NicoView.Model.Service.Comments;
using NicoView.Properties;
using NicoView.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace NicoView.View.Converter
{
    public class UserImagePathConverter : IValueConverter  
    {
        

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var commentViewModel = (NicoViewCommentViewModel)value;

            switch (commentViewModel.UserType)
            {
                case CommentUserType.Owner:
                    return "../Images/owner.png";

                case CommentUserType.Manager:
                    return "../Images/manager.png";

                default:
                    if (commentViewModel.ImagePath.Length == 0)
                    {
                        if (commentViewModel.IsAnonymous)
                        {
                            return "../Images/anonymous.png";
                        }
                        return "../Images/blank.png";
                    }
                    else
                    {
                        return commentViewModel.ImagePath;
                    }
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
